package xxl.robotlegs.extensions.contextsignal 
{
	import xxl.robotlegs.extensions.contextsignal.api.IContextSignal;
	import xxl.robotlegs.extensions.contextsignal.impl.ContextSignal;
	import xxl.robotlegs.framework.api.IContext;
	import xxl.robotlegs.framework.api.IExtension;
	
	/**
	 * ...
	 * @author XXL
	 */
	public class ContextSignalExtension implements IExtension 
	{
		private var _context:IContext;
		private var _contextSignal:IContextSignal;
		
		public function ContextSignalExtension(contextSignal:IContextSignal = null) 
		{
			_contextSignal = contextSignal;
		}
		
		public function toString():String
		{
			return "ContextSignalExtension（简介：通过Inject可以获得一个公用的IContextSignal，自己实现需要保证是safelyExecute的）";
		}
		
		/* INTERFACE xxl.robotlegs.framework.api.IExtension */
		
		public function extend(context:IContext):void 
		{
			_context = context;
			_contextSignal = _contextSignal || new ContextSignal(String);
			context.injector.map(IContextSignal).toValue(_contextSignal);
		}
		
	}

}